1 /*
2  * Copyright (c) 2011-2014 - Mauro Carvalho Chehab
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation version 2.1 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
17  *
18  * Per-delivery system properties defined at libdvbv5 scope, following
19  * the same model as defined at the Linux DVB media specs:
20  * 	http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html
21  */
22 
23 module libdvbv5_d.dvb_v5_std;
24 
25 extern (C):
26 
27 /**
28  * @file dvb-v5-std.h
29  * @ingroup frontend
30  * @brief Provides libdvbv5 defined properties for the frontend.
31  * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
32  * @author Mauro Carvalho Chehab
33  *
34  * @par Bug Report
35  * Please submit bug reports and patches to linux-media@vger.kernel.org
36  */
37 
38 /*
39  * User DTV codes, for internal usage. There are two sets of
40  * properties. One for DTV properties and another one for statistics
41  */
42 
43 /*
44  * First set: DTV properties that don't belong to Kernelspace
45  *
46  * Those properties contain data that comes from the MPEG-TS
47  * tables, like audio/video/other PIDs, and satellite config
48  */
49 
50 /**
51  * @def DTV_USER_COMMAND_START
52  *	@brief Start number for libdvbv5 user commands
53  *	@ingroup frontend
54  * @def DTV_POLARIZATION
55  *	@brief Satellite polarization (for Satellite delivery systems)
56  *	@ingroup frontend
57  * @def DTV_AUDIO_PID
58  * 	@brief Audio PID
59  *	@ingroup frontend
60  * @def DTV_VIDEO_PID
61  *	@brief Video PID
62  *	@ingroup frontend
63  * @def DTV_SERVICE_ID
64  *	@brief MPEG TS service ID
65  *	@ingroup frontend
66  * @def DTV_CH_NAME
67  *	@brief Digital TV service name
68  *	@ingroup frontend
69  * @def DTV_VCHANNEL
70  *	@brief Digital TV channel number. May contain symbols
71  *	@ingroup frontend
72  * @def DTV_SAT_NUMBER
73  *	@brief Number of the satellite (used on multi-dish Satellite systems)
74  *	@ingroup frontend
75  * @def DTV_DISEQC_WAIT
76  *	@brief Extra time needed to wait for DiSeqC to complete, in ms.
77  *		The minimal wait time is 15 ms. The time here will be
78  *		added to the minimal time.
79  *	@ingroup frontend
80  * @def DTV_DISEQC_LNB
81  *	@brief LNBf name
82  *	@ingroup frontend
83  * @def DTV_FREQ_BPF
84  *	@brief SCR/Unicable band-pass filter frequency in kHz
85  *	@ingroup frontend
86  * @def DTV_PLS_CODE
87  *	@brief DVB-T2 PLS code. Not used internally. It is needed
88  *			only for file conversion.
89  *	@ingroup frontend
90  * @def DTV_PLS_MODE
91  *	@brief DVB-T2 PLS mode. Not used internally. It is needed
92  *			only for file conversion.
93  *	@ingroup frontend
94  * @def DTV_COUNTRY_CODE
95  *	@brief Country variant of international delivery system standard.
96 		in ISO 3166-1 two letter code.
97  *	@ingroup frontend
98  * @def DTV_MAX_USER_COMMAND
99  *	 @brief Last user command
100  *	@ingroup frontend
101  * @def DTV_USER_NAME_SIZE
102  *	 @brief Number of user commands
103  *	@ingroup frontend
104  */
105 
106 enum DTV_USER_COMMAND_START = 256;
107 
108 enum DTV_POLARIZATION = DTV_USER_COMMAND_START + 0;
109 enum DTV_VIDEO_PID = DTV_USER_COMMAND_START + 1;
110 enum DTV_AUDIO_PID = DTV_USER_COMMAND_START + 2;
111 enum DTV_SERVICE_ID = DTV_USER_COMMAND_START + 3;
112 enum DTV_CH_NAME = DTV_USER_COMMAND_START + 4;
113 enum DTV_VCHANNEL = DTV_USER_COMMAND_START + 5;
114 enum DTV_SAT_NUMBER = DTV_USER_COMMAND_START + 6;
115 enum DTV_DISEQC_WAIT = DTV_USER_COMMAND_START + 7;
116 enum DTV_DISEQC_LNB = DTV_USER_COMMAND_START + 8;
117 enum DTV_FREQ_BPF = DTV_USER_COMMAND_START + 9;
118 enum DTV_PLS_CODE = DTV_USER_COMMAND_START + 10;
119 enum DTV_PLS_MODE = DTV_USER_COMMAND_START + 11;
120 enum DTV_COUNTRY_CODE = DTV_USER_COMMAND_START + 12;
121 
122 enum DTV_MAX_USER_COMMAND = DTV_COUNTRY_CODE;
123 
124 enum DTV_USER_NAME_SIZE = 1 + DTV_MAX_USER_COMMAND - DTV_USER_COMMAND_START;
125 
126 /**
127  * @enum dvb_sat_polarization
128  * @brief Polarization types for Satellite systems
129  * @ingroup satellite
130  *
131  * @param POLARIZATION_OFF		Polarization disabled/unused.
132  * @param POLARIZATION_H		Horizontal polarization
133  * @param POLARIZATION_V		Vertical polarization
134  * @param POLARIZATION_L		Left circular polarization (C-band)
135  * @param POLARIZATION_R		Right circular polarization (C-band)
136  */
137 enum dvb_sat_polarization
138 {
139     POLARIZATION_OFF = 0,
140     POLARIZATION_H = 1,
141     POLARIZATION_V = 2,
142     POLARIZATION_L = 3,
143     POLARIZATION_R = 4
144 }
145 
146 /*
147  * Second set: DTV statistics
148  *
149  * Those properties contain statistics measurements that aren't
150  * either provided by the Kernel via property cmd/value pair,
151  * like status (with has its own ioctl), or that are derivated
152  * measures from two or more Kernel reported stats.
153  */
154 
155 /**
156  * @def DTV_STAT_COMMAND_START
157  *	@brief Start number for libdvbv5 statistics commands
158  *	@ingroup frontend
159  * @def DTV_STATUS
160  *	@brief Lock status of a DTV frontend. This actually comes from
161  *			the Kernel, but it uses a separate ioctl.
162  *	@ingroup frontend
163  * @def DTV_BER
164  * 	@brief Bit Error Rate. This is a parameter that it is
165  *			derivated from two counters at the Kernel side
166  *	@ingroup frontend
167  * @def DTV_PER
168  *	@brief Packet Error Rate. This is a parameter that it is
169  *			derivated from two counters at the Kernel side
170  *	@ingroup frontend
171  * @def DTV_QUALITY
172  * 	@brief A quality indicator that represents if a locked
173  *			channel provides a good, OK or poor signal. This is
174  *			estimated considering the error rates, signal strengh
175  *			and/or S/N ratio of the carrier.
176  *	@ingroup frontend
177  * @def DTV_PRE_BER
178  *	@brief Bit Error Rate before Viterbi. This is the error rate
179  *			before applying the Forward Error Correction. This is
180  *			a parameter that it is derivated from two counters
181  *			at the Kernel side.
182  *	@ingroup frontend
183  * @def DTV_MAX_STAT_COMMAND
184  *	@brief Last statistics command
185  *	@ingroup frontend
186  * @def DTV_STAT_NAME_SIZE
187  *	@brief Number of statistics commands
188  *	@ingroup frontend
189  * @def DTV_NUM_KERNEL_STATS
190  *	@brief Number of statistics commands provided by the Kernel
191  *	@ingroup frontend
192  * @def DTV_NUM_STATS_PROPS
193  *	@brief Total number of statistics commands
194  *	@ingroup frontend
195  */
196 
197 enum DTV_STAT_COMMAND_START = 512;
198 
199 enum DTV_STATUS = DTV_STAT_COMMAND_START + 0;
200 enum DTV_BER = DTV_STAT_COMMAND_START + 1;
201 enum DTV_PER = DTV_STAT_COMMAND_START + 2;
202 enum DTV_QUALITY = DTV_STAT_COMMAND_START + 3;
203 enum DTV_PRE_BER = DTV_STAT_COMMAND_START + 4;
204 
205 enum DTV_MAX_STAT_COMMAND = DTV_PRE_BER;
206 
207 enum DTV_STAT_NAME_SIZE = 1 + DTV_MAX_STAT_COMMAND - DTV_STAT_COMMAND_START;
208 
209 /* There are currently 8 stats provided on Kernelspace */
210 enum DTV_NUM_KERNEL_STATS = 8;
211 
212 enum DTV_NUM_STATS_PROPS = DTV_NUM_KERNEL_STATS + DTV_STAT_NAME_SIZE;
213 
214 /**
215  * @enum dvb_quality
216  * @brief Provides an estimation about the user's experience
217  *	  while watching to a given MPEG stream
218  * @ingroup frontend
219  *
220  * @param DVB_QUAL_UNKNOWN	Quality could not be estimated, as the Kernel driver
221  *			doesn't provide enough statistics
222  *
223  * @param DVB_QUAL_POOR	The signal reception is poor. Signal loss or packets
224  *			can be lost too frequently.
225  * @param DVB_QUAL_OK	The signal reception is ok. Eventual artifacts could
226  *			be expected, but it should work.
227  * @param DVB_QUAL_GOOD	The signal is good, and not many errors are happening.
228  *			The user should have a good experience watching the
229  *			stream.
230  */
231 enum dvb_quality
232 {
233     DVB_QUAL_UNKNOWN = 0,
234     DVB_QUAL_POOR = 1,
235     DVB_QUAL_OK = 2,
236     DVB_QUAL_GOOD = 3
237 }
238 
239 /*
240  * Some tables to translate from value to string
241  *
242  * These tables are raw ways to translate from some DTV  values into strings.
243  * Please use the API-provided function dvb_cmd_name() and dvb_dvb_attr_names(),
244  * instead of using the tables directly.
245  */
246 
247 extern __gshared const(uint)[] sys_dvbt_props;
248 extern __gshared const(uint)[] sys_dvbt2_props;
249 extern __gshared const(uint)[] sys_isdbt_props;
250 extern __gshared const(uint)[] sys_atsc_props;
251 extern __gshared const(uint)[] sys_atscmh_props;
252 extern __gshared const(uint)[] sys_dvbc_annex_ac_props;
253 extern __gshared const(uint)[] sys_dvbc_annex_b_props;
254 extern __gshared const(uint)[] sys_dvbs_props;
255 extern __gshared const(uint)[] sys_dvbs2_props;
256 extern __gshared const(uint)[] sys_turbo_props;
257 extern __gshared const(uint)[] sys_isdbs_props;
258 extern __gshared const(uint)*[] dvb_v5_delivery_system;
259 extern __gshared const(char)*[6] dvb_sat_pol_name;
260 extern __gshared const(char)*[14] dvb_user_name;
261 extern __gshared const(char)*[6] dvb_stat_name;
262 extern __gshared const(void)*[] dvb_user_attr_names;
263 
264 /* DOXYGEN_SHOULD_SKIP_THIS */
265